//===============================================================================
// Q4Tech Engineering Team
// Mobile Updater Application Block - November 2006
//===============================================================================
// Copyright  Q4Tech Informatica Argentina.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================

using Microsoft.ApplicationBlocks.Mobile.Updater;
using System;
using System.Collections.Generic;
using System.Text;

namespace Q4Tech.Engineering.UpdaterAgent.Management
{
    internal class BaseEventArgs : EventArgs
    {
        Manifest manifest;

        public BaseEventArgs(Manifest manifest)
        {
            this.manifest = manifest;
        }

        public Manifest Manifest
        {
            get
            {
                return manifest;
            }
        }
    }

    public class CheckForUpdatesStartedEventArgs : EventArgs
    {
        private bool autoLaunch;

        public CheckForUpdatesStartedEventArgs(bool autoLaunch)
        {
            this.autoLaunch = autoLaunch;
        }

        public bool AutoLaunch
        {
            get { return autoLaunch; }
        }
    }

    public delegate void CheckForUpdatesStartedEventHandler(object sender, CheckForUpdatesStartedEventArgs args);

    public class CheckForUpdatesFinishedEventArgs : EventArgs
    {
        private bool autoLaunch;

        public CheckForUpdatesFinishedEventArgs(bool autoLaunch)
        {
            this.autoLaunch = autoLaunch;
        }

        public bool AutoLaunch
        {
            get { return autoLaunch; }
        }
    }

    public delegate void CheckForUpdatesFinishedEventHandler(object sender, CheckForUpdatesFinishedEventArgs args);

    internal class InfoAvailableEventArgs : EventArgs
    {
        private String info;

        private bool trivial;

        public InfoAvailableEventArgs(String info, bool trivial)
        {
            this.info = info;
            this.trivial = trivial;
        }

        public String Info
        {
            get { return info; }
        }

        public bool Trivial
        {
            get { return trivial; }
        }
    }

    internal delegate void InfoAvailableEventHandler(object sender, InfoAvailableEventArgs args);

    internal class DownloadCompleteEventArgs : BaseEventArgs
    {
        public DownloadCompleteEventArgs(Manifest manifest)
            : base(manifest)
        {
        }
    }

    internal delegate void DownloadCompleteEventHandler(object sender, DownloadCompleteEventArgs args);

    internal class ActivationStartedEventArgs : BaseEventArgs
    {
        public ActivationStartedEventArgs(Manifest manifest)
            : base(manifest)
        {
        }
    }

    internal delegate void ActivationStartedEventHandler(object sender, ActivationStartedEventArgs args);

    internal class ActivationCompletedEventArgs : BaseEventArgs
    {
        private bool success;

        public ActivationCompletedEventArgs(Manifest manifest,bool success)
            : base(manifest)
        {
            this.success = success;
        }

        
        public bool Success
        {
            get { return success; }
        }
	
    }

    internal delegate void ActivationCompletedEventHandler(object sender, ActivationCompletedEventArgs args);

    internal class ActivationSuspendedEventArgs : BaseEventArgs
    {
        private String reason;

        public ActivationSuspendedEventArgs(Manifest manifest, String reason)
            : base(manifest)
        {
            this.reason = reason;
        }

        public String Reason
        {
            get { return reason; }
        }
    }

    internal delegate void ActivationSuspendedEventHandler(object sender, ActivationSuspendedEventArgs args);

    internal class UpdateSuspendedEventArgs : BaseEventArgs
    {
        private String reason;

        public UpdateSuspendedEventArgs(Manifest manifest, String reason)
            : base(manifest)
        {
            this.reason = reason;
        }

        public String Reason
        {
            get { return reason; }
        }	
    }

    internal delegate void UpdateSuspendedEventHandler(object sender, UpdateSuspendedEventArgs args);

    internal class PendingUpdateResumedEventArgs : EventArgs
    {
        private Manifest[] manifests;

        public PendingUpdateResumedEventArgs(Manifest[] manifests)
        {
            this.manifests = manifests;
        }

        public Manifest[] Manifests
        {
            get { return manifests; }
        }
    }

    internal delegate void PendingUpdateResumedEventHandler(object sender, PendingUpdateResumedEventArgs args);

    internal class UpdateErrorEventArgs : BaseEventArgs
    {
        private String error;
        private Exception ex;

        public UpdateErrorEventArgs(Manifest manifest, String error, Exception ex)
            : base (manifest)
        {
            this.error = error;
            this.ex = ex;
        }

        public String Error
        {
            get { return error; }
        }
        
        public Exception Exception
        {
            get { return ex; }
        }	
    }

    internal delegate void UpdateErrorEventHandler(object sender, UpdateErrorEventArgs args);

    internal delegate void ConnectionStatusChangedEventHandler(object sender, EventArgs args);
}
